from time import sleep
from multiprocessing import Process #导入进程
import os #获取进程id

def rw1():
    while True:
        sleep(1)
        print('--------任务一',os.getpid(),'------',os.getppid())

def rw2():
    while True:
        sleep(1)
        print('--------任务一',os.getpid(),'------',os.getppid())

if __name__ == '__main__':
    p = Process(target=rw1,name='任务一')
    p.start()
    p1 = Process(target=rw2,name='任务二')
    p1.start()

    print('----------------',os.getppid())

